home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
falcon
/
utils
/
rez_fool.lzh
/
RTFSETU3.S
< prev
next >
Wrap
Text File
|
1993-09-05
|
53KB
|
2,851 lines
*
* Standard routine for GEM programs, by WtP (some help from Abacus GEM PR)
*
* Supports shared memory
*
editfile EQU 0
write_it EQU 1
info_file EQU 2
edit_mem EQU 3
want_rgb_file EQU 4
want_tv_file EQU 5
got_vga_file EQU 6
got_rgb_file EQU 8
got_tv_file EQU 9
editmem EQU 1
reset EQU 1
edit_file EQU 2
fool_rgb_mem EQU 3
fool_tv_mem EQU 4
got_vga_mem EQU 5
got_rgb_mem EQU 7
got_tv_mem EQU 8
info_edit EQU 11
info_form EQU 2
exit_info EQU 1
show_me EQU 12
menu EQU 3
desk_menu EQU 3
edit_menu EQU 4
misc_menu EQU 5
about EQU 8
edit_mem_menu EQU 17
edit_file_menu EQU 18
quit_menu EQU 20
write_menu EQU 21
reset_menu EQU 22
unknown_path EQU 4
ok_unknow_p EQU 1
write_e EQU 5
ok_write_e EQU 1
faked EQU 6
ok_faked EQU 1
good_write EQU 7
write_good EQU 1
shower EQU 8
will EQU 1
* opt X+ *long symbols for debugging
text: bra starter
dc.b "This program written by Pontus Sköld aka WtP of Section One ... "
dc.b "Ryllshyttan 1, 776 98 Garpenberg, Sweden ... Send me a postcard ..."
even
starter: move.l sp,d0
bne.s got_stack
move.l a0,a6
bra.s dont_read_bp_adr
got_stack:
move.l 4(sp),a6
dont_read_bp_adr:
movea.l 16(a6),a4 *address to data segment
movea.l 24(a6),a5 *and to bss segment
move.l 12(a6),d0
add.l 20(a6),d0
add.l 28(a6),d0
add.l #$1400,d0
lea stack-bss(a5),sp
move.l d0,-(sp)
move.l a6,-(sp)
clr.w -(sp)
move.w #$4a,-(sp)
trap #1
lea 12(sp),sp
bsr init_once *setup variables one time only
tst.w acc_load-bss(a5)
bne acc_mode
moveq #0,d0
bsr graf_mouse
move.l tree_pointer-bss(a5),a0
move.l menu*4(a0),a0
moveq #1,d0
bsr menu_bar
start_acc_run: bsr popup_window
cmp.l #4*editmem,rcs_screen-bss(a5)
beq update_mem_screen
cmp.l #4*editfile,rcs_screen-bss(a5)
beq update_file_screen
bsr send_redraw
window_handling_loop:
bsr check_rezf
bsr init_em_parameters
lea em_buffer-bss(a5),a0
bsr setup_em_mesag
bsr setup_em_keyboard
moveq #2,d0
moveq #1,d1
moveq #1,d2
bsr setup_em_button
bsr do_evnt_multi
return_from_evnt:
cmp.w #1,d0
bne not_keyboard_event
cmp.b #13,intout+11-bss(a5) *return or enter
bne not_keyboard_event
move.l rcs_screen-bss(a5),d0
lsr.l #1,d0
lea default_list-bss(a5),a0
move.w 0(a0,d0.w),d0
bpl object_selected
bra window_handling_loop
not_keyboard_event:
cmp.w #2,d0
bne not_mouse_button
* bsr init_em_parameters *Touch exit on everything
* moveq #1,d0
* moveq #1,d1
* moveq #0,d2
* bsr setup_em_button
* bsr do_evnt_multi
move.w intout+2-bss(a5),d6
sub.w work_x-bss(a5),d6
move.w intout+4-bss(a5),d7
sub.w work_y-bss(a5),d7
tst.w d6
bmi not_mouse_button
tst.w d7
bmi not_mouse_button
cmp.w work_w-bss(a5),d6
bpl not_mouse_button
cmp.w work_h-bss(a5),d7
bpl not_mouse_button
move.w intout+12-bss(a5),d0
cmp.w #2,d0
bne not_toggle_screens
tst.l text_adr-bss(a5)
bne toggle_screens
cmp.l #editfile*4,rcs_screen-bss(a5)
bne toggle_screens
bra window_handling_loop
not_toggle_screens:
moveq #0,d0 *start with object null
moveq #7,d1 *7 levels
move.w intout+2-bss(a5),d2 *mouse x
move.w intout+4-bss(a5),d3 *mouse y
move.l tree_pointer-bss(a5),a0
add.l rcs_screen-bss(a5),a0
move.l (a0),a0
bsr objc_find
tst.w d0
bmi window_handling_loop
move.l tree_pointer-bss(a5),a0
add.l rcs_screen-bss(a5),a0
move.l (a0),a0
move.l d0,d2
mulu #24,d2
move.w 8(a0,d2.l),d1
and.w #%1000101,d1
btst #0,d1 *not selectable, nothing to
beq window_handling_loop *care about
btst #2,d1
beq window_handling_loop
btst #6,d1 *if touchexit, goto object selected
bne object_selected
move.l tree_pointer-bss(a5),a0
add.l rcs_screen-bss(a5),a0
move.l (a0),a0
move.w 10(a0,d2.l),d5 *get old status
or.w #1,d5 *highlighted
move.w work_x-bss(a5),d1
move.w work_y-bss(a5),d2
move.w work_w-bss(a5),d3
move.w work_h-bss(a5),d4
moveq #0,d7
move.w d0,d7
moveq #1,d6
bsr objc_change
move.l d7,d0
move.l tree_pointer-bss(a5),a0
add.l rcs_screen-bss(a5),a0
move.l (a0),a0
bsr objc_offset
move.w intout+2-bss(a5),d1 *get x &?Γúµ?s
move.w intout+4-bss(a5),d2 *for object...
bsr init_em_parameters
move.l d7,d0
mulu #24,d0
move.l tree_pointer-bss(a5),a0
add.l rcs_screen-bss(a5),a0
move.l (a0),a0
move.w 20(a0,d0.l),d3
move.w 22(a0,d0.l),d4
moveq #1,d0
bsr setup_em_mouse1
moveq #1,d0 *max 1 click
moveq #1,d1 *only left counts
moveq #0,d2 *until release...
bsr setup_em_button
bsr do_evnt_multi
move.w d0,-(sp) *save intout 0...
move.l d7,d0 *object #
mulu #24,d0
move.l tree_pointer-bss(a5),a0
add.l rcs_screen-bss(a5),a0
move.l (a0),a0
move.w work_x-bss(a5),d1
move.w work_y-bss(a5),d2
move.w work_w-bss(a5),d3
move.w work_h-bss(a5),d4
move.w 10(a0,d0.l),d5 *get old status
and.w #$fffe,d5 *not highlighted
move.l d7,d0
moveq #1,d6
bsr objc_change
move.w (sp)+,d1
move.l d7,d0
btst #1,d1 *if it was mouse released
bne object_selected *go to object_selected
bra window_handling_loop
not_mouse_button:
cmp.w #$10,d0
bne window_handling_loop
move.w em_buffer+4-bss(a5),d1
beq.s not_read_more
move.w appl_id-bss(a5),d0
lea em_buffer+16-bss(a5),a0
bsr appl_read
not_read_more:
* move.w appl_id-bss(a5),d0 *???
* cmp.w em_buffer+2-bss(a5),d0
* bne window_handling_loop
move.w em_buffer-bss(a5),d0
cmp.w #10,d0
beq menu_options
cmp.w #41,d0
bne.s not_ac_close
move.w em_buffer+6-bss(a5),d1
cmp.w desk_id-bss(a5),d1
beq delete_window_and_exit
not_ac_close: cmp.w #"RF",d0
beq message_to_me
move.w window_handle-bss(a5),d1
cmp.w em_buffer+6-bss(a5),d1
bne window_handling_loop
cmp.w #22,d0 *wm_close
beq close_window_and_exit
cmp.w #20,d0 *wm_update
beq update_screen
cmp.w #21,d0 *wm_top
beq top_my_window
cmp.w #10,d0
beq menu_options
cmp.w #28,d0 *wm_moved
bne window_handling_loop
move.w em_buffer+8-bss(a5),window_x-bss(a5) *read new
move.w em_buffer+10-bss(a5),window_y-bss(a5) *pos
move.w em_buffer+12-bss(a5),window_w-bss(a5)
move.w em_buffer+14-bss(a5),window_h-bss(a5)
move.w window_handle-bss(a5),d0
moveq #5,d1
move.w window_x-bss(a5),d2
move.w window_y-bss(a5),d3
move.w window_w-bss(a5),d4
move.w window_h-bss(a5),d5
bsr wind_set
move.w window_handle-bss(a5),d0 *get workarea
moveq #4,d1 *coords
bsr wind_get
move.w intout+2-bss(a5),work_x-bss(a5) *save, so we now it's
move.w intout+4-bss(a5),work_y-bss(a5) *current position
move.w intout+6-bss(a5),work_w-bss(a5)
move.w intout+8-bss(a5),work_h-bss(a5)
move.l tree_pointer-bss(a5),a0 *
add.l rcs_screen-bss(a5),a0
move.l (a0),a0
move.w work_x-bss(a5),16(a0) *update tree coordinates
move.w work_y-bss(a5),18(a0)
bra window_handling_loop
close_window_and_exit:
bsr close_window
delete_window_and_exit:
bsr delete_window
move.w desk_id-bss(a5),d0
cmp.w #"er",d0
bne acc_loop
*
* Go look for accs...
*
* This only for program ...
moveq #0,d0 *erase bar
move.l tree_pointer-bss(a5),a0
move.l menu*4(a0),a0
bsr menu_bar
something_wrong:
bsr close_virtual
bsr appl_exit
moveq #0,d0
bra.s quit_right_now
acc_mode: move.w appl_id-bss(a5),d0
lea acc_name-data(a4),a0
bsr menu_register
tst.w d0 *if no handle, go something
bmi something_wrong *wrong (exit)
move.w d0,desk_id-bss(a5)
acc_loop: bsr init_em_parameters
lea em_buffer-bss(a5),a0
bsr setup_em_mesag
bs